package cn.rdq.iknesssystem.controller;

import cn.rdq.api.po.User;
import cn.rdq.api.vo.UserVo;
import cn.rdq.common.CommonResult;
import cn.rdq.iknesssystem.service.UserService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@Api
@RequestMapping("/user")
public class UserController {

    @Autowired
    private UserService userService;

    @PostMapping("/list")
    public CommonResult list(@RequestBody UserVo userVo) {
        List<User> users = userService.queryUsers(userVo);
        return CommonResult.success().pageSuccess(users);
    }

    @GetMapping("/del/{id}")
    public CommonResult delete(@PathVariable Long id) {
        userService.delete(id);
        return CommonResult.success();
    }

}
